<template>
    <section>
        <!--工具条-->
        <div class="searchgrid">
            <div style="width:400px;float:left;">
                <span class="h5"><b>总成交金额:</b>{{forms.sum_makedeal_amount}} 元</span>
                &nbsp;&nbsp;
                <span class="h5"><b>总产生佣金:</b>{{forms.sum_commission}} 元</span>
            </div>
            <div style="float: right;">
                <input v-model="post_data.search.stock_finance_id" style="width:120px;height:20px;"
                       value="" maxlength="10" type="text" placeholder="搜索:子账户ID">
                <input v-model="post_data.has.client.search.cellphone" style="width:120px;height:20px;"
                       value="" maxlength="10" type="text" placeholder="搜索:客户手机号">
                <input class="yl-input-button" value=" 查询 " type="button" v-on:click="search">
            </div>
        </div>

        <!--列表-->
        <el-table :data="forms.list"
                  highlight-current-row
                  v-loading="loading"
                  style="width: 100%;">

            <el-table-column prop="stock_finance_id" label="子账户ID" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="isUserSystemAdmin" prop="parent_stock_finance_id" label="母账户ID" show-overflow-tooltip></el-table-column>
            <el-table-column prop="client.cust_info" min-width="120px" label="客户信息" show-overflow-tooltip></el-table-column>
            <el-table-column prop="makedeal_date_time" min-width="130" label="成交日期" show-overflow-tooltip></el-table-column>
            <el-table-column prop="sell_buy" label="买卖标志" show-overflow-tooltip></el-table-column>
            <el-table-column prop="makedeal_price" label="成交单价" show-overflow-tooltip></el-table-column>
            <el-table-column prop="makedeal_quantity" label="成交数量" show-overflow-tooltip></el-table-column>
            <el-table-column prop="makedeal_amount" label="成交金额" show-overflow-tooltip></el-table-column>
            <el-table-column prop="id" label="成交ID" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="isUserSystemAdmin" prop="parent_makedeal_id" label="成交编号" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="isUserSystemAdmin" prop="stocker_commission" label="券商佣金" show-overflow-tooltip></el-table-column>
            <el-table-column prop="commission" label="佣金" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="isUserSystemAdmin" prop="stamp_duty" label="印花税" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="isUserSystemAdmin" prop="transfer_fee" label="过户费" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="isUserSystemAdmin" prop="brokerage" label="经手费" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="isUserSystemAdmin" prop="witness_fee" label="见证费" show-overflow-tooltip></el-table-column>
            <el-table-column v-if="isUserSystemAdmin" prop="fees" label="规费" show-overflow-tooltip></el-table-column>

        </el-table>

        <!--工具条-->
        <div class="pagination">
            <el-col :span="24" class="toolbar">
                <el-pagination
                        @size-change="changeSize"
                        @current-change="pageChange"
                        :current-page="post_data.offset/post_data.limit+1"
                        :page-sizes="[15, 30, 45, 60]"
                        :page-size="post_data.limit"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="forms.count"
                        style="float:left;">
                </el-pagination>
            </el-col>
        </div>
    </section>
</template>

<script>
    import {getUStockFinanceMakedealFees} from '../../../api/trade';
    export default {
        data() {
            return {
                loading: false,
                forms: {},
                post_data: {
                    field: ['id', 'cust_id', 'stock_finance_id', 'sell_buy', 'stocker_commission', 'commission', 'stamp_duty',
                        'makedeal_price', 'makedeal_quantity', 'makedeal_amount', 'parent_stock_finance_id', 'transfer_fee', 'brokerage',
                        'witness_fee', 'fees', 'parent_makedeal_id', 'makedeal_date', 'makedeal_time', '"" as makedeal_date_time'],
                    search: {
                        stock_finance_id: ''
                    },
                    count: true,
                    offset: 0,
                    limit: 15,
                    client: {
                        field: ['id', 'nick_name', 'cellphone', '"" as cust_info']
                    },
                    has: {
                        client: {
                            search: {
                                cellphone: ''
                            }
                        }
                    },
                    order: 'id desc'
                }
            }
        },
        created(){
            this.getList();
        },
        methods: {
            getList: function () {
                this.loading = true;
                getUStockFinanceMakedealFees(this.post_data).then(res => {
                    this.loading = false;
                    if (res.status === 0) return this.ezNotifyAxiosThen(res);
                    this.forms = res.data;
                }).catch(err => this.loading = false)
            },
            pageChange: function (index) {
                this.post_data.offset = (index - 1) * this.post_data.limit;
                this.getList();
            },
            changeSize: function (num) {
                this.post_data.offset = 0;
                this.post_data.limit = num;
                this.getList();
            },
            search: function () {
                this.post_data.offset = 0;
                this.getList();
            }
        }
    }
</script>

<style scoped>
</style>
